﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DevExpress.Data.Filtering;
using DevExpress.ExpressApp;
using DevExpress.Xpo;
using TransLogger.Module.BusinessObjects;

namespace TransLogger.Module
{
    public class DbHelper
    {
        public static Vehicle FindVehicleByLicenseNumber(Session session, string value)
        {
            var vehicles = session.Query<Vehicle>();
            return (from v in vehicles where v.LicensePlateNumber == value select v).FirstOrDefault();
        }

        public static Vehicle FindVehicleByLicenseNumber(IObjectSpace session, string value)
        {
            return session.FindObject<Vehicle>(CriteriaOperator.Parse("LicensePlateNumber = ?", value));
        }
    }
}
